package com.mao.wx.demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

@Configuration
@EnableWebMvc
@ComponentScan(basePackages={"com.mao.wx.demo.api"})
public class WebConfig extends WebMvcConfigurerAdapter  {

	
	@Bean(name="viewResolver")
	public ViewResolver getViewResolver(){
		InternalResourceViewResolver viewResovler=new InternalResourceViewResolver();
		viewResovler.setPrefix("/WEB-INF/jsp/");
		viewResovler.setSuffix(".jsp");
		return viewResovler;
	}

	@Override
	public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
		// TODO Auto-generated method stub
		super.configureDefaultServletHandling(configurer);
		configurer.enable();
	}
	
}
